package fr.umlv.m2.recipes.ideas.bean;

import java.io.Serializable;

/**
 * Creation of a Recipe 
 * @author kayan
 *
 */
@SuppressWarnings("serial")
public class RecipeBean implements Serializable {
	
	private int id;
	private String name;
	private String description;
	private int votes;
	private int difficulty;
	private String pictureLink;
	private short bookmark;
	
	/**
	 * Create a Recipe
	 */
	public RecipeBean(){}
	
	/**
	 * Create a Recipe
	 * @param name
	 * @param description
	 * @param difficulty
	 */
	public RecipeBean(String name,String description,int difficulty){
		this.name = name;
		this.description = description;
		this.difficulty = difficulty;
		this.bookmark = 0;
		this.pictureLink = "";
		this.votes = 0;
	}
	
	/**
	 * Create a Recipe
	 * @param name
	 * @param description
	 * @param difficulty
	 * @param pictureLink
	 * @param recipeId
	 */
	public RecipeBean(String name,String description,int difficulty,String pictureLink, int recipeId){
		this(name, description, difficulty);
		this.pictureLink = pictureLink;
	}

	/**
	 * Get the id of the Recipe
	 * @return the id of the Recipe stored in the database 
	 */
	public int getId() {
		return id;
	}

	/**
	 * Set the id of the Recipe
	 * @param id
	 */
	public void setId(int id) {
		this.id = id;
	}
	
	/**
	 * Get the name of the Recipe
	 * @return the name of the recipe stored in the database
	 */
	public String getName() {
		return name;
	}

	/**
	 * Set the name of the Recipe
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Get the description of the recipe
	 * @return the description of the recipe stored in the database
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Set the description of the recipe
	 * @param description
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * Get the votes for the recipe
	 * @return integer - the votes for the recipe
	 */
	public int getVotes() {
		return votes;
	}

	/**
	 * Set the votes for a recipe
	 * @param votes
	 */
	public void setVotes(int votes) {
		this.votes = votes;
	}

	/**
	 * Get the level of the difficulty of the recipe
	 * @return integer - the level of the recipe
	 */
	public int getDifficulty() {
		return difficulty;
	}

	/**
	 * Set the level of the difficulty
	 * @param difficulty
	 */
	public void setDifficulty(int difficulty) {
		this.difficulty = difficulty;
	}
	
	/**
	 * Get the link of the recipe
	 * @return the link of the recipe stored in the database
	 */
	public String getPictureLink() {
		return pictureLink;
	}
	
	/**
	 * Set the link of the recipe in the database
	 * @param pictureLink
	 */
	public void setPictureLink(String pictureLink) {
		this.pictureLink = pictureLink;
	}

	/**
	 * Get the bookmark field in the database
	 * @return 0 if the recipe isn't a bookmark (favorite), 1 otherwise
	 */
	public short getBookmark() {
		return bookmark;
	}

	/**
	 * Set the bookmark field in the database
	 * @param bookmark
	 */
	public void setBookmark(short bookmark) {
		this.bookmark = bookmark;
	}

	/**
	 * @see Object
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("RECETTE DU : ").append(name).append("\n");
		builder.append("DIFFICULTE : ").append(difficulty).append("\n");
		builder.append("-- description --").append("\n").append("\n");
		builder.append(description);
		return builder.toString();
	}
	
	
}
